# pragma once

# include "cpp_tools_Headers.h"

namespace cpp_tools
{
    class threadPool
    {
    protected:
        std::vector<std::thread> pool_;
    public:
        threadPool(){};

        void joinAll()
        {
            for (auto &t: pool_)
            {
                if (t.joinable())
                {
                    t.join();
                }
            }

            pool_.clear();
        }

        ~threadPool()
        {
            joinAll();
        };

        void push_back(std::thread & thread)
        {
            pool_.push_back(std::move(thread));
        }
    };
} // namespace cpp_tools
